package com.xm.servlet;

import com.xm.biz.RegionBiz;
import com.xm.biz.impl.RegionBizImpl;
import com.xm.po.Region;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;

/**
 * @author xie'lin'feng
 * @date 2020-08-11-16:32
 * @description 用户地址处理器
 */
@WebServlet("/address")
public class UsersAddressServlet extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        doPost(req,resp);
    }

    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        req.setCharacterEncoding("utf-8");
        RegionBiz regionBiz = new RegionBizImpl();
        List<Region> regionList = regionBiz.regionList(1);
        req.setAttribute("regionList",regionList);
        req.getRequestDispatcher("person/address.jsp").forward(req,resp);
    }
}
